-
-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow activeProps to infer component props #2347
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit bace58c. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
9368534
to
29e2264
Compare
export type UseLinkPropsOptions< | ||
TRouter extends AnyRouter = RegisteredRouter, | ||
TFrom extends RoutePaths<TRouter['routeTree']> | string = string, | ||
TTo extends string | undefined = '.', | ||
TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, | ||
TMaskTo extends string = '.', | ||
> = ActiveLinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & | ||
React.AnchorHTMLAttributes<HTMLAnchorElement> | ||
> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
about the 'a'
: please see this comment #2092 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works with 'a' properly now ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool!
@mirague check this out
…into create-link-types
props: Parameters<typeof Button>[0], | ||
ref: React.Ref<HTMLButtonElement>, | ||
) => { | ||
return <Button {...props} ref={ref} component={Link} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and how does this button then get access to the to
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to? Its there at runtime but its not been typed. I'm not sure the use case for this though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if you want to navigate to to
upon button click?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a similar usecase for getting access to the active: boolean
property to render a different variant of the component based on the Link
being active.
(activeProps
doesn't seem to propagate as expected)
bdff996
to
bace58c
Compare
Fixes #2079